<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="jquery/jquery.min.js"></script>
	</head>
	<body>
		<div>爱好:
		<input type="checkbox" id="hobby" />打篮球
		<input type="checkbox" id="hobby" />跑步
		<input type="checkbox" id="hobby" />打乒乓球
		<input type="checkbox" id="hobby" />打电脑
		</div>
		<div>
			<button  id="selectAll">全选</button>
			<button id="unselectAll">全取消</button>
		</div>
	</body>
	<script>
		$("#selectAll").click(function(){
			$("[id=hobby]").prop("checked",true)
		})
		$("#unselectAll").click(function(){
			$("[id=hobby]").attr("checked",false)
		})
	</script>
</html>
